package com.jiangruan.javaproject;


import com.alibaba.fastjson.JSONObject;
import com.jiangruan.javaproject.address.BitCoinAddress;
import com.jiangruan.javaproject.bean.BitCoinRpc;
import com.jiangruan.javaproject.bean.HotVideo;
import com.jiangruan.javaproject.bean.HotVideoCommon;
import com.jiangruan.javaproject.request.HttpUtils;
import com.jiangruan.javaproject.service.GetBestBlockHashService;
import com.jiangruan.javaproject.service.HotVideoService;

import java.security.KeyPair;
import java.util.List;
import java.util.Scanner;

/**
 * @author:张子寒
 * @QQ:1594426628
 * @desc:该函数为java主函数
 * @DateTime:2021-12-04
 **/

public class Main {
    public static void main(String[] args) {
        boolean b=true;
        while (b){
            System.out.println("-------------------");
            System.out.println("0.退出");
            System.out.println("1.热门视频查询");
            System.out.println("2.连接比特币客户端进行RPC操作");
            System.out.println("3.原生Java推导生成原始格式的比特币地址");
            System.out.println("请输入你想实现的功能");
            System.out.println("-------------------");
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
            switch (a) {
                case 0:
                    b=false;
                    break;
                case 1:
                    HotVideoService hotVideoService = new HotVideoService();
                    hotVideoService.getHotVideo();
                    break;
                case 2:
                    GetBestBlockHashService getBestBlockHashService = new GetBestBlockHashService();
                    BitCoinRpc bestBlockHash = getBestBlockHashService.getBestBlockHash();
                    System.out.println("result:" + bestBlockHash.result);
                    break;
                case 3:
                    BitCoinAddress test = new BitCoinAddress();
                    KeyPair keyPair = test.generateKey();
                    String s = test.newAddress(keyPair);
                    System.out.println("比特币地址为:"+s);
                    break;
                default:
                    System.out.println("不支持的功能,请重试");
                    break;
            }
        }
        }
    }

